package com.cnxjs.shs4et.repository;

import com.cnxjs.shs4et.common.Result;
import com.cnxjs.shs4et.entity.Comment;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

public interface CommentRepository extends JpaRepository<Comment, Long> {

    // 按照帖子和发布时间降序查所有评论
    List<Comment> findAllByCommentTopicOrderByPublishTimeDesc(int commentTopic);
    // 按照帖子和发布时间升序查所有评论
    List<Comment> findAllByCommentTopicOrderByPublishTimeAsc(int commentTopic);
    // 按照帖子和点赞数量降序查所有评论
    List<Comment> findAllByCommentTopicOrderByRecommendCountDesc(int commentTopic);

    // 按照commentId查评论
    Comment findById(int commentId);
}
